| Conditions | 1 |
| Paths | 8 |
| Total Lines | 27 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | /* |
||
| 14 | module.exports = function () { |
||
| 15 | API.checkSignedIn() |
||
| 16 | |||
| 17 | Module.getManifest(function (manifest) { |
||
| 18 | if (!('name' in manifest) || !manifest.name || typeof manifest.name !== 'string' || !manifest.name.length) { |
||
| 19 | output.err('Please set a valid value for key `name` in module.json') |
||
| 20 | return |
||
| 21 | } |
||
| 22 | |||
| 23 | runHelpers.createZipArchive('.', function (zipFile, size, unlinkFn) { |
||
| 24 | const spinner = output.wait(runHelpers.logSyncMessage('Uploading module (' + size + ')', true)) |
||
| 25 | |||
| 26 | const data = new FormData(null) |
||
| 27 | data.append('file', fs.createReadStream(zipFile)) |
||
| 28 | |||
| 29 | API.post('/modules/publish', data, {headers: data.getHeaders()}).then(function (response) { |
||
| 30 | spinner() |
||
| 31 | output.success('+ ' + response.data.data.message) |
||
| 32 | console.log('It can take up to three minutes before your update is propagated everywhere') |
||
|
|
|||
| 33 | unlinkFn() |
||
| 34 | }).catch(function (response) { |
||
| 35 | spinner(response.response.data.error || 'Network error') |
||
| 36 | unlinkFn() |
||
| 37 | }) |
||
| 38 | }) |
||
| 39 | }) |
||
| 40 | } |
||
| 41 |